package com.example;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.ArrayList;
import java.util.List;

@Controller
public class HelloController {

    @RequestMapping("/index")
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView("index");
        modelAndView.addObject("num",189);
        List<String> names = new ArrayList<>();
        names.add("jack");
        names.add("tom");
        names.add("rose");
        modelAndView.addObject("names",names);
        return modelAndView;
    }
}
